package personal.service.accounting;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import personal.dao.accounting.ExternalEntityDAO;
import personal.domain.accounting.ExternalEntity;


@Service
public class ExternalEntityServiceImpl implements ExternalEntityService {
	
	private ExternalEntityDAO externalEntityDAO;

	public ExternalEntityDAO getExternalEntityDAO() {
		return externalEntityDAO;
	}

	@Autowired(required=false)
	public void setExternalEntityDAO(ExternalEntityDAO externalEntityDAO) {
		this.externalEntityDAO = externalEntityDAO;
	}

	@Override
	@Transactional(readOnly=true)
	public List<ExternalEntity> getAllExternalEntities() {
		return externalEntityDAO.getAllExternalEntities();
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public ExternalEntity saveExternalEntity(ExternalEntity entity) {
		return externalEntityDAO.saveExternalEntity(entity);
	}
}
